feat: even more general ring switch - #615
Conversation
🤖 PR SummaryThis PR generalizes the ring-switching layer to decoupled packing and opening algebras, as documented in Flock (BRW26) and the internal note RSG. The core change is the introduction of the Generic ring-switching subdirectory ( Statistics
Lean Declarations ✏️ Added: 110 declaration(s)
📋 **Additional Analysis**The diff introduces a large new generic ring-switching layer, fixes a bug in BinaryBasefold, and updates documentation. Overall it follows the ArkLib style guide closely, but a few minor violations were found. 📄 **Per-File Summaries**
The addition details the seven-step spine every ring switch shares, the four safety pillars (coordinate maps derived from a bundled Newly described files and theorems include:
The documentation also notes that
Last updated: 2026-07-11 23:48 UTC. |
|
big next step will be the reduction & soundness. |
…rface
- Generic/Relations.lean: framework-fixed relation chain — openingClaimRel
anchor (+ non-vacuity witness), sliceRel, sumcheckClaimRel, and the proven
chain coherence sumcheckClaim_of_slices (via bridge_eqTilde); PackedCommitment
(commitsTo + functionality law + Nonempty guard; the legacy True-hook is
unstatable: commitsTo_not_top / commitsTo_ne_top); DenseMLPCS mirroring
MLIOPCS with relIn fixed to evalRel (= MLPEvalRelation AND commitsTo), so the
PCS's own completeness/RBR fields consume the binding predicate
- Data/Module/Basis.lean (new): reusable Basis.sum_smul_{bijective,injective};
Recombine.lean refactored onto it + openingDecomposition_injective (the
opening half of Flock Remark 5)
- Binius/FRIBinius/Prelude.lean: biniusCommitsTo (commitsTo orientation of the
legacy initialCompatibility, rfl-pinned); documents the pre-existing upstream
diagonal-coercion bug in firstOracleWitnessConsistencyProp (encoding reads
t's diagonal evaluations, so commitsTo functionality is unprovable until the
upstream spelling is fixed — recorded S7 gate)
- KB ring-switching page + repo-map updated; ArkLib.lean regenerated
All new declarations sorry-free and axiom-clean; RingSwitching sorry count
unchanged at 14; binaryTowerProfile untouched. Hardened via a 4-pass
independent adversarial close-review (structural Nonempty guard, precision
fixes, upstream bug confirmed by compiled probe and logged).
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
firstOracleWitnessConsistencyProp, getMidCodewords, and the honest-witness lens in FRIBinius/CoreInteractionPhase built P0 from `fun w => t.val.eval w`, where the silent coercion Fin (2^l) -> (Fin l -> L) is the pointwise Nat-cast CONSTANT function — the "novel coefficients" were t's evaluations at diagonal points, not its hypercube table, making the encoding non-injective (X 0 and X 1 collapsed definitionally; compiled counterexample) and the predicate unusable as binding semantics (functionality provably false). Fix: new named encoder BinaryBasefold.witnessNovelCoeffs — t's cube table in the LSB-first Nat.getBit order, the exact inverse of the decoder's Nat.binaryFinMapToNat mapping (roundtrip: getBit_of_binaryFinMapToNat) — used at all three sites; a repo-wide sweep found no further instances. Compiled regression probe: witnessNovelCoeffs now separates X 0 / X 1. The biniusCommitsTo functionality proof (S7) is provable-as-sketched again. Pre-existing bug (predates this PR); all consumers are sorry-gated statements, so nothing proven was invalidated. Found by the S5 close-review adversarial passes. Docstrings and the KB page updated accordingly. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Review finding: the R7 regression probe was verified in-session but never committed, so nothing in-tree would catch the diagonal-encoding bug regressing. Adds a generic-field example separating witnessNovelCoeffs (X 0) from (X 1) at omega = 1 - unprovable under the pre-fix diagonal spelling. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Two plumbing lemmas for RBR-game factoring (generic ring-switch S6):
- probEvent_uniformSample_eq_pr_uniformOfFintype: Pr[E | $t C] equals
the PMF-level Pr_{c <-$p C}[E c]
- probEvent_bind_uniformSample_le: a per-prefix PMF bound transfers to
the bind (prefix; uniform challenge; pair) - the challenge-round shape
Both sorry-free and axiom-clean ([propext, Classical.choice, Quot.sound]).
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Verifier.probEvent_challengeRound_le: bounds the RBR-game shape
(prefix; uniformly sampled challenge i; post-map) by any epsilon that
bounds the PMF-level bad-event probability for every fixed prefix
outcome - the bridge from simulateQ (impl.addLift challengeQueryImpl)
games to Pr_{c <- $p _} per-round analyses (BatchingStrategy.separates).
The prefix is an arbitrary OracleComp (no prover unfolding); the
post-map covers the games' (transcript, challenge, queryLog) triple.
Sorry-free, axiom-clean. Closes the bootstrapped 'medium' plumbing item;
the feared erw-chain reduced to one erw [simulateQ_query].
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
… check (S6/F2) The design-review F2 algebra, all sorry-free and axiom-clean: - Packing.lean: generic unpack (coefficient-wise packBasis.repr) with the round-trip PROVEN both directions (packedMLE_unpack / unpack_packedMLE; packedMLE_surjective constructive) - CommRing-only, honoring the file's no-assumed-round-trip disclaimer - Relations.lean: claimConsistent (DP24 Check 1 in family form, the [BRW26] Remark-5 read-back equation) + both directions: openingClaimRel_of_claimConsistent (soundness read-back, [IsDomain E] - the logged S6 deviation) and claimConsistent_of_slices (completeness) - Data/MvPolynomial/Multilinear.lean: aeval_multilinear_eq_sum_eqTilde (eq-expansion of a multilinear at an algebra point; reusable) INV-2: exercised on tower, decoupled-toy (CommRing-only parts) and decoupled-field (domain-gated parts) carriers. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
…uction Generic/Reduction.lean: the ProtocolSpec 2 phase (prover sends slices, verifier sends batching challenge) written WITHOUT the composition operators, so every definition is sorry-free and axiom-clean (verified: standard 3 axioms on all 8 public decls) despite upstream OracleVerifier.append.verify being sorried. - Verifier performs the soundness-critical claim-consistency check (design review F1: without it the phase RBR statement is false), and fails via OptionT failure, not a dummy statement - phaseRelIn = openingClaimRel AND commitsTo (packedMLE wit) - the oracle-extended anchor promised at S5; phaseRelOut carries commitsTo through to the sumcheck claim - Per-round error VECTOR (bat.error at the single challenge round) - WitMid/extractor via unpack; RBR knowledge soundness recorded as a Prop-valued def (roadmap section 8, F3) pending the stretch proof - W := car.iE pinned; INV-2 examples on tower + decoupled-field carriers Also folds ChallengeRound.lean + Reduction.lean into the ArkLib.lean umbrella (283 imports). Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
…o first) ringSwitchPhase_rbrKnowledgeSound: the ring-switch phase is round-by-round knowledge sound with error bat.error at the batching-challenge round - the FIRST non-vacuous RBR probability bound completed in ArkLib (the three prior real ones are all sorried). - phaseKnowledgeStateFunction [IsDomain car.E]: round 1 tracks the Remark-5 check + binding + slice relation; round 2 re-tracks the check (the verifier fails without it), binding, and the batched claim; toFun_full cases on the verifier's definitional if and kills the failure branch by empty support - phase_badEvent_le: commitsTo_functional collapses the existential to the committed t'0; the surviving event is exactly BatchingStrategy.separates on the sent slices vs the honest slices of t'0 (via sumcheckClaim_of_slices); no-commitment branch has probability zero - Verifier.probEvent_rbrGame_le (Security/ChallengeRound.lean): the factoring lemma restated at the literal game shape - unifying the game's destructuring bind against the plain-bind lemma diverges in whnf (structure-eta through the prover term), so the same proof script is replayed with the matcher fired by one constructor-level obtain All axiom-clean ([propext, Classical.choice, Quot.sound]); zero sorry tokens; no maxHeartbeats override needed; whole library green. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Independent adversarial close-review verdict: theorem holds up, 'repo first' claim accurate, no blockers. Adds its two suggested witnesses: phaseRelIn nonemptiness (true claims + trivial commitment - the RBR obligation is not discharged by an empty input relation) and an end-to-end application of ringSwitchPhase_rbrKnowledgeSound at decoupledFieldCarrier with the PROVEN gamma-powers strategy (real separation error 3/4). Honest caveats recorded in roadmap section 8: phase completeness deferred (next session), and the repo-wide RBR->knowledge-soundness implication remains sorried upstream. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
…ter hardening (checkpoint) WIP checkpoint (one temporary sorry in Generic/Reduction.lean — the verifier-side support peel of ringSwitchPhase_perfectCompleteness). NOT for push; C-SORRY-in-Generic is momentarily 1 by design of this checkpoint. Everything else builds green and is sorry-free. Landed this session: - Ported the OptionT support-peel toolkit from feat/abf26-plan (same VCVio pin, strict supersets): ToVCVio/.../SimulateQ.lean (OptionT run-bind/lift peelers, probEvent_eq_one_of_simulateQ_support_bind) and OracleReduction/Execution.lean (per-direction processRound unfolds). - PCS B-2 honest-committer hardening (Relations.lean): PackedCommitment now carries `commit` + `commitsTo_commit` (subsumes the bare `neC` nonemptiness guard); new commitsTo_ne_bot (False-hook unstatable, dual to commitsTo_ne_top) and evalRel_nonempty (PCS input relation provably nonempty — S5 close-review residual B-2 closed). - Phase completeness (Reduction.lean): point-form honest_mem_phaseRelOut and honest_claimConsistent PROVEN; the protocol-level ringSwitchPhase_perfectCompleteness has its full prover-run peel + verifier-query resolution working, one sorry at the final support read-off (resume notes inline). Also validated (not in this commit, scratch): F4 relation-chain gate probe compiles — commitsTo threads phaseRelIn -> phaseRelOut -> sumcheck rounds -> pcs.evalRel -> acceptRejectOracleRel end to end. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…er query resolution Extends the f0c1d70 checkpoint. ringSwitchPhase_perfectCompleteness now has the full prover-run peel (challenge fixed), the verifier slice-query resolution (`hq`), and the Remark-5 check discharge (`hcheck`) all compiling; the lone remaining sorry is the final verifier-side support read-off — a pure monadic-normalization step (OptionT.pure-bind is defeq but not syntactic). Resume notes inline point to porting the toy protocol's `verifierBody_simulateQ_eq_pure` pattern as a dedicated value lemma. Builds green; RingSwitching/Generic sorry = 1 (this WIP), non-generic still 14; Data/Fin/* pre-existing sorries untouched. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…s (S6 phase completeness DONE) The final verifier-side support read-off is closed by re-ascribing `hx` to its defeq-collapsed forms (`replace hx : … := hx`, accepted by isDefEq) — bridging the OptionT.pure-bind gap that blocks syntactic `pure_bind`/`if_pos` — then `if_pos hcheck` and a final defeq collapse to `pure (some finalValue)`; closes with `honest_mem_phaseRelOut` (relOut) and `rfl` (prover/verifier statement agreement). `classical` threads the verifier's `Classical.propDecidable` instance. Independently verified: `lake build …Generic.Reduction` green (3596 jobs); `#print axioms ringSwitchPhase_perfectCompleteness` = [propext, Classical.choice, Quot.sound] (no sorryAx); source scan clean. RingSwitching/Generic now sorry-free again; non-generic C-SORRY still 14. The phase security package (RBR knowledge soundness + perfect completeness) is now fully certified — closes the S5/S6 close-review "half-certified" concern. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
… (INV-2, non-domain P) Bundles Hachi's proven `psi_bijective` ([NOZ26] §3 Theorem 2) into a `Basis` and instantiates `RingSwitchCarrier` with `B = E = R_q^H` (the fixed subfield) and `P = R_q`. Why it matters: * INV-2 in its strongest form to date. The two existing carriers (`towerCarrier`, `decoupledFieldCarrier`) are both field packing algebras; this one has a NON-DOMAIN `P`. Four `example`s apply the generic results (`recombine_bijective`, `openingDecomposition_injective`, `bridge_eqTilde`, `packedMLE_eval`) to it verbatim — none needs `[IsDomain P]`, which is exactly the honest fork working as designed. * The generic carrier now covers all four established packing-family ring switches: DP24/Binius, the [RSG] decoupled note, Flock App. B, and Hachi §3. * `ιE = Unit`: Hachi's subfield-valued evaluation point makes the opening basis a singleton, which is the structural reason [NOZ26] §3's relocation is deterministic where DP24's is interactive. Data layer only — the reduction-level collapse is not claimed here. Also adds the missing `Nontrivial (Rq (powTwoCyclotomic α))` instance (belongs upstream in `CyclotomicRing/`, kept local for now). Sorry-free; all declarations axiom-clean ([propext, Classical.choice, Quot.sound]). Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
…undary Adds the `HachiCarrier.lean` status entry, an explicit coverage statement (the generic carrier instantiates at all four established packing-family switches: DP24/Binius, RSG, Flock App. B, Hachi §3), and the honest-fork upgrade from asserted to demonstrated. Also states the boundary plainly: the HMZ25 `Lift` switch is NOT covered — its transport map is not a ring map, so the packing-`Basis` vocabulary does not reach it. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
🤖 PR SummaryThe PR introduces a new generic ring-switching framework that generalizes the previous tower-specific Statistics
Lean Declarations ✏️ Added: 150 declaration(s)
📄 **Per-File Summaries**
Last updated: 2026-08-02 00:29 UTC. |
Further generalization of the ring-switching abstraction based on discussion around https://github.com/leanEthereum/leanVM-b/blob/main/misc/ring-switching-generalized.pdf and Flock.
WIP, but should not be a huge PR once the generic layer (mostly in the current draft) is in place, binius and hachi (if the ring switching stage is reached before this is merged) will be ported accordingly.